﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace WindowAPI
{
    /// <summary>
    /// 从屏幕上采集特定点的颜色
    /// </summary>
    public class ColorPick
    {
        /// <summary>
        /// 编号
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// 哪个模块
        /// </summary>
        public int Part { get; set; }
        /// <summary>
        /// 红色
        /// </summary>
        public int R { get; set; }
        /// <summary>
        /// 绿色
        /// </summary>
        public int G { get; set; }
        /// <summary>
        /// 蓝色
        /// </summary>
        public int B { get; set; }
        /// <summary>
        /// X轴坐标
        /// </summary>
        public int X { get; set; }
        /// <summary>
        /// Y轴坐标
        /// </summary>
        public int Y { get; set; }

        /// <summary>
        /// 保存截取的点的信息
        /// </summary>
        public void Insert()
        {
            Common.ADO.DBManager.Insert(this);
        }
    }

    /// <summary>
    /// 自动喊话的内容
    /// </summary>
    public class Message
    {
        /// <summary>
        /// 编号
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// 喊话内容
        /// </summary>
        public string Content { get; set; }
        /// <summary>
        /// 冷却时间
        /// </summary>
        public int CoolingTime { get; set; }

        /// <summary>
        /// 保存自动喊话的内容
        /// </summary>
        public void Insert()
        {
            Common.ADO.DBManager.Insert(this);
        }

        /// <summary>
        /// 得到最新的一条自动喊话的内容
        /// </summary>
        /// <returns></returns>
        public Message GetTopOneMessage()
        {
            Message message = null;
            List<object> objs = Common.ADO.DBManager.GetTopList(1, new Message());
            if (objs.Count > 0)
            {
                message = (Message)objs[0];
            }
            else
            {
                message = new Message();
            }
            return message;
        }
    }

    /// <summary>
    /// 人物的技能
    /// </summary>
    public class Skill
    {
        /// <summary>
        /// 编号
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// 技能名称
        /// </summary>
        public string SkillName { get; set; }
        /// <summary>
        /// 冷却时间
        /// </summary>
        public int CoolingTime { get; set; }
        /// <summary>
        /// 键盘对应的按键
        /// </summary>
        public string Key { get; set; }

        /// <summary>
        /// 获取所有技能
        /// </summary>
        /// <returns></returns>
        public static List<Skill> GetAllSkill()
        {
            Skill skill = new Skill();
            List<object> objs = Common.ADO.DBManager.GetList(skill);
            List<Skill> skills = new List<Skill>();
            foreach (Skill sk in objs)
            {
                skills.Add(sk);
            }
            return skills;
        }

        public void Insert()
        {
            Common.ADO.DBManager.Insert(this);
        }

        public void DeleteAll()
        {
            string sql = "delete from Skill";
            Common.ADO.Tools.WinFormAccessHelper.ExecuteNonQuery(sql);
        }
    }
    /// <summary>
    /// 药品
    /// </summary>
    public class Medicine
    {
        /// <summary>
        /// 药品编号
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// 药品名称
        /// </summary>
        public string MedicineName { get; set; }
        /// <summary>
        /// 冷却时间
        /// </summary>
        public int CoolingTime { get; set; }
        /// <summary>
        /// 键盘对应的按键
        /// </summary>
        public string Key { get; set; }

        /// <summary>
        /// 获取所有药品配置
        /// </summary>
        /// <returns></returns>
        public static List<Medicine> GetAllMedicine()
        {
            Medicine skill = new Medicine();
            List<object> objs = Common.ADO.DBManager.GetList(skill);
            List<Medicine> skills = new List<Medicine>();
            foreach (Medicine sk in objs)
            {
                skills.Add(sk);
            }
            return skills;
        }

        public void Insert()
        {
            Common.ADO.DBManager.Insert(this);
        }

        public void DeleteAll()
        {
            string sql = "delete from Medicine";
            Common.ADO.Tools.WinFormAccessHelper.ExecuteNonQuery(sql);
        }
    }


    /// <summary>
    /// 判断是否有选中的怪物的点
    /// </summary>
    public class GuaiwuExistPoint
    {
        /// <summary>
        /// 编号
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// 红色
        /// </summary>
        public int R { get; set; }
        /// <summary>
        /// 绿色
        /// </summary>
        public int G { get; set; }
        /// <summary>
        /// 蓝色
        /// </summary>
        public int B { get; set; }
        /// <summary>
        /// X轴坐标
        /// </summary>
        public int X { get; set; }
        /// <summary>
        /// Y轴坐标
        /// </summary>
        public int Y { get; set; }

        public List<GuaiwuExistPoint> GetList()
        {
            List<GuaiwuExistPoint> points = new List<GuaiwuExistPoint>();
            var query = Common.ADO.DBManager.GetList(new GuaiwuExistPoint());
            foreach (GuaiwuExistPoint point in query)
            {
                points.Add(point);
            }
            return points;
        }

        public void Insert()
        {
            Common.ADO.DBManager.Insert(this);
        }
    }


    /// <summary>
    /// 判断是否需要加血的点
    /// </summary>
    public class NeedAddBooldPoint
    {
        /// <summary>
        /// 编号
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 红色
        /// </summary>
        public int R { get; set; }
        /// <summary>
        /// 绿色
        /// </summary>
        public int G { get; set; }
        /// <summary>
        /// 蓝色
        /// </summary>
        public int B { get; set; }
        /// <summary>
        /// X轴坐标
        /// </summary>
        public int X { get; set; }
        /// <summary>
        /// Y轴坐标
        /// </summary>
        public int Y { get; set; }
        /// <summary>
        /// 哪个模块
        /// </summary>
        public int Part { get; set; }

        public List<NeedAddBooldPoint> GetList()
        {
            List<NeedAddBooldPoint> points = new List<NeedAddBooldPoint>();
            var query = Common.ADO.DBManager.GetList(new NeedAddBooldPoint());
            foreach (NeedAddBooldPoint point in query)
            {
                points.Add(point);
            }
            return points;
        }

        public void Insert()
        {
            Common.ADO.DBManager.Insert(this);
        }
    }

    [StructLayout(LayoutKind.Sequential)]
    public struct Point
    {
        public int x;
        public int y;
    }
}
